home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3942 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  39 lines

  1. Newsgroups: comp.lang.c,comp.lang.c++,alt.msdos.programmer
  2. Path: mxsld2.pd.infn.it!LORETI
  3. From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
  4. Subject: Re: Clearing the keyboard buffer
  5. X-Nntp-Posting-Host: mxsld2.pd.infn.it
  6. Message-ID: <DLt4p1.37x@news.cern.ch>
  7. Sender: news@news.cern.ch (USENET News System)
  8. Reply-To: loreti@mxsld2.pd.infn.it
  9. Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
  10. References: <4dtqi4$60u@cdc2.cdc.net>,<4e07uh$oqq@huron.eel.ufl.edu>
  11. Date: Fri, 26 Jan 1996 21:22:11 GMT
  12.  
  13. In article <4e07uh$oqq@huron.eel.ufl.edu>, afn03257@freenet2.freenet.ufl.edu (Daniel P Hudson) writes:
  14. >In article <4dtqi4$60u@cdc2.cdc.net>,
  15. >mart@vianet.on.ca (Mart) wrote:
  16. >
  17. > > I'm using Turbo C++ v. 3.1 and I need to be able to clear the keyboard
  18. > > BTW, this following bit of code wouldn't work :
  19. >
  20. > > while(kbhit()) getch();
  21. >
  22. > > Because I want the user to be able to just keep pushing the same key,
  23. > > making the above loop infinitly. If I don't clear the keyboard buffer, 
  24. > > my code will continue believing that the user is pushing a key, even 
  25. > > though their not.
  26. >
  27. > Huh? Once the buffer is caught up, it shouldn't continue, but you
  28. > might want to try fflush(stdin);
  29.  
  30. Bullshit.  Read the FAQ list to learn why this is an error;
  31. specifically Q/A 12.26:
  32.  
  33. 12.26:    How can I flush pending input so that a user's typeahead isn't
  34.     read at the next prompt?  Will fflush(stdin) work?
  35.  
  36. --
  37. Maurizio Loreti                       http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
  38. Un. of Padova, Dept. of Physics - Padova, Italy          loreti@padova.infn.it
  39.